package com.briup.product_source.controller;

import com.briup.product_source.result.Result;
import com.briup.product_source.service.DiseaseRecordService;
import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "病症记录模块")
@RestController
@RequestMapping("/diseaseRecord")
public class DiseaseController {
    @Autowired
    private DiseaseRecordService diseaseService;
    @GetMapping("/queryAllDisease")
    @Operation(summary = "查询所有病症信息")
    public Result queryAll(){
        return Result.success(diseaseService.findAllDiseases());
    }

    //分页+条件查询检疫记录
    @GetMapping
    @Operation(summary = "分页+条件查询病症记录")
    @Parameters({
            @Parameter(name = "pageNum",description = "当前页码",in = ParameterIn.QUERY),
            @Parameter(name = "pageSize",description = "每页大小",in = ParameterIn.QUERY),
            @Parameter(name = "drStatus",description = "未治疗|治疗中|已治疗",in = ParameterIn.QUERY),
            @Parameter(name = "drDId",description = "病症id",in = ParameterIn.QUERY),
    })
    public Result findByPage(Integer pageNum, Integer pageSize,
                             @RequestParam(required = false) String drStatus,
                             @RequestParam(required = false) Integer drDId){
        return Result.success(diseaseService.findByPage(pageNum,pageSize,drStatus, drDId));
    }

}
